home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / BEND.ZIP / PENCIL.POV < prev    next >
Encoding:
Text File  |  1997-06-13  |  1.9 KB  |  58 lines

  1. // OBJECT BENDER: WALKING PENCIL ANIMATION
  2. // ***************************************
  3. // This animation illustrates various feature of the Object
  4. // Bender include file.
  5.  
  6. // CAMERA AND LIGHTS
  7.    camera {location <9, 5, -7> look_at <3, 0, 1> angle 25}
  8.    light_source {<5, 15, -5> rgb .8}
  9.    light_source {<5, 5, -15> rgb .8 shadowless}
  10.  
  11. // GROUND PLANE
  12.    disc {<0, 0, 0>, y, 10
  13.       pigment {checker rgb .5, rgb .7}
  14.       normal {quilted .3 control0 0 control1 0}
  15.       finish {reflection .4}
  16.       rotate y * 30 translate x * 3}
  17.  
  18. // CREATE PENCIL
  19.    #declare Pencil = union {
  20.       cone {0, 0, y * .4, .15
  21.          pigment {gradient y pigment_map {
  22.             [.1 rgb 0]
  23.             [.15 wood color_map {[0 rgb <.7, .5, .3>] [1 rgb <.8, .6, .4>]}
  24.                scale .02 rotate <80, 30, 0>]}}}
  25.       cylinder {y * .4, y * 1.75, .15
  26.          pigment {rgb <1, 0, 0>}
  27.          normal {radial -.2 scallop_wave frequency 6}
  28.          finish {phong .3}}
  29.       cylinder {y * 1.75, y * 1.8, .16
  30.          pigment {rgb <.8, .8, .4>}
  31.          finish {phong .6}}
  32.       cylinder {y * 1.8, y * 1.9, .15
  33.          pigment {rgb <.9, .4, .5>}}
  34.       sphere {y * 1.9, .1
  35.          pigment {rgb <.9, .4, .5>}
  36.          scale <1.5, 1, 1.5>}
  37.    }
  38.  
  39. // BEND OPTIONS
  40.    #declare MClock = .5 + clock * 5
  41.    #declare object_axis1 = 0
  42.    #declare object_axis2 = y * 2
  43.    #declare bend_angle = -180 + (mod(MClock, 1) * 360)
  44.    #declare bend_smoothness = 50
  45.    #declare stride_length = 2 * vlength(object_axis2 - object_axis1) / pi
  46.  
  47. // CREATE BENT OBJECT
  48.    object {
  49.  
  50. // USE UPSIDE-DOWN PENCIL FOR EVERY SECOND STEP
  51.    #if (mod(int(MClock), 2) = 0) #declare bend_object = Pencil
  52.       #else #declare bend_object = object {Pencil scale <1, -1, 1> translate y * 2} #end
  53.  
  54.    #include "bend.inc"
  55.  
  56. // TRANSLATE FOR EACH STEP
  57.    translate x * int(MClock) * stride_length}
  58.